<div class="role">

    <section ng-show="isShowManagement">
        <div class="panel-heading clearfix">
            权限管理<p style="color:red">注：点击按钮分配权限（按钮变绿点击全部保存即分配成功）</p>
            <div class="btn-group pull-right" role="group" aria-label="...">
                <button type="button" class="btn btn-warning btn-sm" ng-click="saveManagement()">全部保存</button>
                <button type="button" class="btn btn-default btn-sm" ng-click="isShowManagement=false;showRole=false">收起</button>
            </div>
        </div>
        <div class="Management">
            <ul>
                <li class="ManagementLevel1" ng-repeat="item1 in ManagementLevel" style="width:{{100/ManagementLevel.length}}%">
                        <button ng-click="isCheckedItem(item1.isCheck,item1,item1.code,$index)" ng-model="isChecked.isCheck1" ng-class="item1.isCheck==1?'btn-success':''" class="btn btn-default">{{item1.name}}</button>
                    <ul ng-show="item1.isCheck">
                        <li class="ManagementLevel2" ng-repeat="item2 in item1.childTree" style="width:{{100/(item1.childTree.length)}}%">
                                <button ng-click="isCheckedItem(item2.isCheck,item2,item2.code,$index)" ng-model="isChecked.isCheck2" ng-class="item2.isCheck==1?'btn-success':''" class="btn btn-default">{{item2.name}}</button>
                            <ul  ng-show="item2.isCheck">
                                <li class="ManagementLevel3" ng-repeat="item3 in item2.childTree"  style="width:{{100/(item2.childTree.length)}}%">
                                    <button ng-click="isCheckedItem(item3.isCheck,item3,item3.code,$index)" ng-model="isChecked.isCheck3"  ng-class="item3.isCheck==1?'btn-success':''" class="btn btn-default">{{item3.name}}</button>
                                </li>
                            </ul>
                        </li>
                    </ul>
                </li>
            </ul>
        </div>
    </section>

    <section class="home" ng-show="showAddRole">
        <div class="form-horizontal" style="width:600px; margin-top: 20px;">
            <div class="form-group">
                <label class="col-sm-3 control-label">角色名</label>

                <div class="col-sm-9">
                    <input type="text" class="form-control" ng-model="roleDetail.roleName" placeholder="角色名">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">角色描述</label>
                <div class="col-sm-9">
                    <input type="text" ng-model="roleDetail.remarks" class="form-control" placeholder="角色描述" >
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-3 col-sm-9">
                    <a class="btn btn-default" ng-click="submitRole()">提交</a>
                </div>
            </div>
        </div>
    </section>





    <div class="panel panel-default" ng-show="!showRole">

        <div class="panel-heading clearfix">
            用户组权限管理
            <div class="btn-group pull-right" role="group" aria-label="...">
                <button type="button" class="btn btn-warning btn-sm" ng-click="addRole();">新增角色</button>
            </div>
        </div>
        <table class="table table-bordered table-condensed" >
            <thead>
            <tr>
                <th style="width:25%">
                    角色名称
                </th>
                <!--<th  style="width:10%">-->
                <!--登录密码-->
                <!--</th>-->
                <th  style="width:25%">
                    描述
                </th>
                <th  style="width:25%">
                    创建时间
                </th>
                <th  style="width:25%">
                    操作
                </th>
            </tr>
            </thead>
            <tbody>
            <tr ng-repeat="item in role">
                <td>
                    {{item.roleName}}
                </td>
                <!--<td>-->
                <!--{{item.password}}-->
                <!--</td>-->
                <td>
                    {{item.remarks}}
                </td>
                <td>
                    {{item.ctime}}
                </td>
                <td>
                    <a ng-click="deleteRole(item.roleId)">删除</a>
                    <a ng-click="updateRole(item.roleId)">编辑</a>
                    <a ng-click="Management(item.roleId)">权限管理</a>
                </td>
            </tr>
            </tbody>
        </table>

        <div class="panel-footer" style="text-align: center;">
            <uib-pagination style="margin:0;" ng-change="pageChanged(result.currentPage)" total-items="result.totalSize" ng-model="result.currentPage"
                            items-per-page="result.pageSize" max-size="5" class="pagination-sm" boundary-links="true"
                            rotate="false"></uib-pagination>
        </div>

    </div>
</div>